//
//  BKXVisitorViewController.swift
//  微博
//
//  Created by 田凯 on 16/4/17.
//  Copyright © 2016年 田凯. All rights reserved.
//

import UIKit

class BKXVisitorViewController: UITableViewController {

    
    //定义 判断用户是否登录的标识
    var isLogin:Bool = BKXUserAccountTools.sharedUserAccountTools.isLogin
    //访客视图
    var visitorView: BKXVisitorView?
    
    override func loadView() {
        if isLogin{
        super.loadView()
        
        }else{
        setupvisitorView()
        
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

    }
    // MARK: - 设置nav
    func setNav(){
    navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: UIBarButtonItemStyle.Plain, target: self, action: "login")
        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登陆", style: UIBarButtonItemStyle.Plain, target: self, action: "login")
    
    
    }
    
    // MARK: - 登陆的点击事件
    func login(){
        let oauthVc = BKXOAuthController()
        presentViewController(UINavigationController(rootViewController: oauthVc), animated: true, completion: nil)
        
    }
    
    // MARK: - 设置访客视图
    func setupvisitorView(){
        
        setNav()
    visitorView = BKXVisitorView()
        visitorView?.callbag = {
        
        self.login()
        }
        
        view = visitorView
    
    }

}
